package com.ruoyi.common.utils;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class GetFileContentUtil {
    public static String TEXT_CONTENT = "";

    /**
     * 高级读取流
     */
    public static String buffedInput(InputStream inputStream) {
        try (BufferedInputStream bis = new BufferedInputStream(inputStream)) {
            byte[] bytes = new byte[2048];
            int fileNumber = 0;
            while ((fileNumber = bis.read(bytes)) != -1) {
                TEXT_CONTENT = new String(bytes, 0, fileNumber, "utf-8");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return TEXT_CONTENT;
    }
}
